<?php

namespace Modules\Wechat\Model\Dao\Db;

/**
 * 公众号相关DAO的抽象类
 *
 * @package Modules\Wechat\Model\Dao\Db
 */
abstract class WcOaAbstraction extends Abstraction
{

    public function generatePk($official_account, $open_id)
    {
        return "{$open_id}_{$official_account}";
    }

    public function generatePkByProperty()
    {
        return $this->generatePk(
            $this->getProperty($this->getOfficialAccountPropertyName()),
            $this->getProperty('open_id')
        );
    }

    protected function getOfficialAccountPropertyName()
    {
        return 'official_account';
    }
}